package mapeditor;

import java.awt.Color;
import java.awt.Rectangle;
import java.util.TreeMap;

public class Field {

    static final TreeMap<String, Color> name2Color = new TreeMap<String, Color>() {

        {
            put("Blocked ", Color.BLACK);
//            put("BLUE", Color.BLUE);
//            put("CYAN", Color.CYAN);
//            put("DARK_GRAY", Color.DARK_GRAY);
//            put("GRAY", Color.GRAY);
            put("Starting point ", Color.GREEN);
//            put("LIGHT_GRAY", Color.LIGHT_GRAY);
//            put("MAGENTA", Color.MAGENTA);
//            put("ORANGE", Color.ORANGE);
//            put("PINK", Color.PINK);
//            put("RED", Color.RED);
//            put("YELLOW", Color.YELLOW);
            put("Unblock", Color.WHITE);
        }
    };

    static Color getColorForName(String name) {
        return name2Color.get(name);
    }

    static String getNameForColor(Color color) {
        for (String name : name2Color.keySet()) {
            if (getColorForName(name) == color) {
                return name;
            }
        }
        return null;
    }

    static Character getShortForColor(Color color) {
        char c = 'a';
        for (String name : name2Color.keySet()) {
            if (getColorForName(name) == color) {
                return c;
            }
            c++;
        }
        return null;
    }

    Color c;
    Rectangle r;

    Field(Color color, Rectangle rect) {
        c = color;
        r = rect;
    }
}
